<?php  
                                              
			
			
			$year=$_POST['sltYr'];
			$grade=$_POST['sltGrade'];
			$check=$_POST['rType'];
			
			if($check=="pie"){
			
			include'../logic/Classes/db.php';

            $x=new DbConnect();
            $con=$x->getConnection();

			include'../logic/Classes/reportHandler.php';  
			
			$tot=NULL;
			$x=NULL;
			$z=NULL;
			$w=NULL;
			
			$rep=new ReportHandler();
			$rep->setCon($con);
			
			$result1=$rep->getAnnualGrade($grade,$year);
            $result2=$rep->getAnnualGrade($grade,$year);
			$result3=$rep->getAnnualGrade($grade,$year);
			$result4=$rep->getAnnualGrade($grade,$year);
			
			$count=mysql_num_rows($result1);
			
			while($row=mysql_fetch_array($result1)){
			$tot=$tot+$row['income'];
			
			}
			
            ?>
 
 
<script language="JavaScript">
				document.location="http://chart.apis.google.com/chart?chs=600x500&cht=p3&chd=&chd=t:<?php while($row=mysql_fetch_array($result2)){ $x=$x+1;$y=round(($row['income']/$tot)*100);echo $y;if($x<$count){ echo",";}} ?>&chdl=<?php while($row1=mysql_fetch_array($result3)){ $z=$z+1;$month=$row1['months'];if($month==1){

            $mon="January";

            } elseif($month==2){

            $mon="February";

            } elseif($month==3){

            $mon="March";

            } elseif($month==4){

            $mon="April";

            } elseif($month==5){

            $mon="May";

            } elseif($month==6){

            $mon="June";

            }elseif($month==7){

            $mon="July";

           }elseif($month==8){

           $mon="August";

           }elseif($month==9){

           $mon="September";

           }elseif($month==10){

           $mon="October";

          }elseif($month==11){

          $mon="November";

         } else{

        $mon="December";
        }
		 echo $mon;if($z<$count){ echo"|";} }   ?>&chl=<?php while($row=mysql_fetch_array($result4)){ $w=$w+1;echo "Rs.".$row['income'].".00";if($w<$count){ echo"|";}} ?>&chma=200&chtt=Annual+Income +Report+of+Grade&chts=676767,20.5&chma=200,0,0,60&chco=0000FF&chts=060644,20.5&chxs=0,000000,11.5&chxt=x";
		
			</script>
 <?php
 } else{ 
 
 header("location:annual_grade.php?grade=$grade&year=$year"); 
 
 
 } ?>
 
 